
/**
*javascript所涉及的基类
*@author zhenwenxue
*/
if (typeof (HTMLElement) != "undefined" && typeof (HTMLElement.prototype.innerText) == "undefined") {
	eval("HTMLElement.prototype.innerText getter = Getter;");
	eval("HTMLElement.prototype.innerText setter = Setter;");
}
function Getter() {
	var innerHTMLReplace = this.innerHTML.replace(/<BR>/gi, "\n");
	return innerHTMLReplace.replace(/<[^>]+>/g, "");
}
function Setter(text) {
	var TextNodeElement = document.createTextNode(text);
	this.innerHTML = "";
	this.appendChild(TextNodeElement);
}
function SaturnElement() {
	this.tag = null;
}
/**
* @description	getTag	 获取标签 tag属性
*/
function getTag() {
	return this.tag;
}
/**
* @description	setTag	 设置标签tag属性
*/
function setTag(Tag) {
	this.tag = Tag;
}
SaturnElement.prototype.getTag = getTag;
SaturnElement.prototype.setTag = setTag;
function isSaturnComponent(weblordComponent) {
	return (weblordComponent.saturnClass != null && weblordComponent.getId == getId);
}
function SaturnComponent() {
}
SaturnComponent.prototype = new SaturnElement();
/**
* @description	getId	 获取id
*/
function getId() {
	return this.id;
}
/**
* @description	isActive	 判断组件是否为激活状态
*/
function isActive() {
	return this.uMap02;
}
/**
* @description	activate	激活组件
*/
function activate() {
	if (!this.uMap02) {
		this.uMap02 = true;
		fireSaturnEvent(this, "onActive", [this]);
	}
}
/**
* @description	getViewModel	获取视图
*/
function getViewModel() {
	return this.viewModel;
}
SaturnComponent.prototype.getId = getId;
SaturnComponent.prototype.isActive = isActive;
SaturnComponent.prototype.activate = activate;
SaturnComponent.prototype.getViewModel = getViewModel;
/**
* @description	SaturnException	初始化异常
*/
function SaturnException(message) {
	this.saturnClass = "SaturnException";
	this.message = message;
}
/**
* @description	getMessage	    获取异常信息
*/
SaturnException.prototype.getMessage = function () {
	return this.message;
};
/**
* @description	toString	   异常转换成字符串
*/
SaturnException.prototype.toString = function () {
	return this.message;
};
function AbortException() {
	this.message = "abort";
}
AbortException.prototype = new SaturnException();
/**
* @description	outputExceptionMessage	   输出异常信息
*/
function outputExceptionMessage(e) {
	switch (typeof (e)) {
	  case "string":
		if (e != "abort") {
			if (e) {
				alert(e);
			} else {
				alert(__ERROR_UNKNOWN);
			}
		}
		break;
	  case "object":
		if (e == null) {
			return;
		}
		if (e.saturnClass == "SaturnException") {
			if (e.message != "abort") {
				alert(e);
			}
		} else {
			if (browserType != browserType1) {
				alert("name: " + e.name + "\n" + "message: " + e.message + "\n" + "lineNumber: " + e.lineNumber + "\n" + "fileName: " + e.fileName + "\n" + "stack: " + e.stack);
			} else {
				alert("name: " + e.name + "\n" + "errorNumber: " + (e.number & 65535) + "\n" + "message: " + e.message);
			}
		}
		break;
	}
}
/**
* @description	getInstance	  获取id
*/
function getInstance(id) {
	if (typeof (id) == "object") {
		return id;
	} else {
		if (typeof (id) == "string") {
			return eval(id);
		} else {
			return null;
		}
	}
}
function controlId() {//controlId
	return "__control_" + addId();
}
/**
* @description	registerInitializeProcedure	 注册初始化进程
*/
var array1 = new Array();
var array2 = new Array();
function registerInitializeProcedure($J) {
	array1.push($J);
}
/**
* @description	registerFinalizeProcedure	 注册结束进程
*/
function registerFinalizeProcedure($J) {
	array2.push($J);
}
/**
* @description	onloadViewModel	 加载视图
*/
function onloadViewModel() {
	if (typeof (__startTime) == "object" && typeof (__downloadTime) == "object" && Debugger != null) {
		Debugger.log(__DBUGER_PAGE_DOWNLOAD_TIME + (__downloadTime.getTime() - __startTime.getTime()) / 1000 + " sec.");
	}
	document.body.style.visibility = "visible";
	for (var i = 0; i < array1.length; i++) {
		array1[i]();
	}
	var size = bMap01.size();
	for (var i = 0; i < size; i++) {
		var viewModel01 = bMap01.uArray3[i];
		fireSaturnEvent(viewModel01, "onLoad", [viewModel01]);
	}
	if (typeof (__downloadTime) == "object" && Debugger != null) {
		var cDate02 = new Date();
		Debugger.log(__DBUGER_PAGE_INIT_TIME + (cDate02.getTime() - __downloadTime.getTime()) / 1000 + " sec.");
	}
}
/**
* @description	onUnloadViewModel	 卸载视图
*/
function onUnloadViewModel() {
	var size = bMap01.size();
	for (var i = 0; i < size; i++) {
		var viewModel01 = bMap01.uArray3[i];
		fireSaturnEvent(viewModel01, "onUnload", [viewModel01]);
		viewModel01.destroy();
	}
	for (var i = 0; i < array2.length; i++) {
		array2[i]();
	}
}
if (browserType == browserType1) {
	document.write("<script id=__ie_onload defer src=javascript:void(0)></script>");
	var IEOnloadElement = document.getElementById("__ie_onload");
	IEOnloadElement.onreadystatechange = function () {
		if (this.readyState == "complete") {
			IEOnloadElement.onreadystatechange = null;
			onloadViewModel();
		}
	};
} else {
	EventManager.addSystemEvent(window, "onload", onloadViewModel);
}
EventManager.addSystemEvent(window, "onunload", onUnloadViewModel);
function deleteObject() {
	for (var i = uArray4.length - 1; i >= 0; i--) {
		var bObject06 = uArray4[i];
		bObject06.destroy();
		delete uArray4[i];
	}
}
registerFinalizeProcedure(deleteObject);
/**
* @description	ViewModel	 初始化视图
*/
var bMap01 = new HashList();
var symbel = "+";
/**
* @description	getControl  获取特定组件
*/
function getControl(id, namespace) {
	if (typeof (id) == "object") {
		return id;
	} else {
		if (namespace) {
			id = namespace + "$" + id;
		}
		return bMap03.get(id);
	}
}
/**
* @description	listControls  列出所有组件
*/
function listControls(type) {
	var array3 = new Array();
	var hashArray = bMap03.uArray3;
	for (var i = 0; i < hashArray.length; i++) {
		var control = hashArray[i];
		if (type && control.type01 != type) {
			continue;
		}
		array3.push(control.id);
	}
	return array3;
}
var bMap02 = new HashList();
var bMap03 = new HashList();
function registerDataset(dataset) {
	bMap02.put(dataset.id, dataset);
}
/**
* @description	registerControl  注册组件
*/
function registerControl(control) {
	bMap03.put(control.id, control);
}
/**
* @description	onkeydownDucoment  对页面操作的系统事件
*/
function onkeydownDucoment(event) {
	switch (event.keyCode) {
	  case 123:
		if (event.ctrlKey && event.shiftKey && event.altKey) {
			Debugger.show();
			event.cancelBubble = true;
			return false;
		}
		break;
	  case 122:
		if (event.ctrlKey && event.shiftKey && event.altKey) {
			var IEOnloadElement = prompt("JavaScript", "");
			if (IEOnloadElement) {
				setTimeout("eval(unescape(\"" + escape(IEOnloadElement) + "\"));", 0);
			}
			event.cancelBubble = true;
			return false;
		}
		break;
	}
	var spacialObj = (editorNode1 != null) ? editorNode1 : editorNode2;
	if (spacialObj != null) {
		if (typeof (spacialObj.onKeyDown) == "function") {
			spacialObj.onKeyDown(event);
		}
	}
}
var timeOut;
function excuteResize() {
	if (browserType != browserType1) {
		if (timeOut) {
			clearTimeout(timeOut);
		}
		timeOut = setTimeout("onResizeControl()", 300);
	}
}
/**
* @description	onResizeControl  重设组件大小
*/
function onResizeControl() {
	var hashArray = bMap03.uArray3;
	for (var i = 0; i < hashArray.length; i++) {
		var control = hashArray[i];
		if (typeof (control.onResize) == "function") {
			control.onResize();
		}
	}
}
/**
* @description	onmousedownDocument  系统鼠标事件
*/
function onmousedownDocument(event) {
	var target;
	if (browserType == browserType1) {
		target = event.srcElement;
	} else {
		target = event.target;
	}
	target = getParentElement(target);
	if (target != null) {
		if (target.tagName != "INPUT") {
			decideNode(target);
		}
	} else {
		initInterval();
		interval = setTimeout("decideNode(null)", 300);
	}
}
function $Ra() {
	$xw();
}
/**
* @description	decideNode  判断哪一个接点成为焦点，哪一个接点失去焦点
*/
var editorNode2 = null;
var editorNode1 = null;
var interval = 0;
function decideNode(spacialObj) {
	initInterval();
	var editorNode0 = null;
	var editorNode3 = null;
	var notEditorNode = null;
	if (spacialObj != null) {
		if (getParentNode(spacialObj, "DropDownBox") != null) {
			return;
		}
		var notEditor = getParentNode(spacialObj, "Editor");
		if (notEditor != null) {
			notEditorNode = notEditor;
		}
		notEditor = getParentNode(spacialObj, "CellEditor");
		if (notEditor != null) {
			notEditorNode = notEditor;
			spacialObj = notEditorNode.$6L;
		}
	}
	if (editorNode1 != notEditorNode) {
		if (editorNode1 != null) {
			if (typeof (editorNode1.onBlur) == "function") {
				editorNode1.onBlur();
			}
			editorNode0 = editorNode1;
		}
		editorNode1 = notEditorNode;
		if (notEditorNode != null) {
			if (typeof (notEditorNode.onFocus) == "function") {
				notEditorNode.onFocus();
			}
			editorNode3 = notEditorNode;
		}
	}
	var editorNode4 = null;
	if (spacialObj != null) {
		editorNode4 = getParentElement(spacialObj);
	}
	if (editorNode2 != editorNode4) {
		if (editorNode2 != null) {
			editorNode2._hasFocus = false;
			if (editorNode0 != editorNode2 && typeof (editorNode2.onBlur) == "function") {
				editorNode2.onBlur();
			}
		}
		editorNode2 = editorNode4;
		if (editorNode4 != null) {
			editorNode4._hasFocus = true;
			if (editorNode3 != editorNode2 && typeof (editorNode2.onFocus) == "function") {
				editorNode2.onFocus();
			}
		}
	}
}
function initInterval() {
	if (interval) {
		clearTimeout(interval);
		interval = 0;
	}
}
/**
* @description	getParentElement  获取父结点
*/
function getParentElement(spacialObj) {
	var bNode = spacialObj;
	while (bNode != null && !bNode.$Vv) {
		bNode = bNode.parentNode;
	}
	return bNode;
}
/**
* @description	__Element_onFocus  结点成为焦点
*/
function Element_onFocus(spacialObj) {
	decideNode(spacialObj);
}
/**
* @description	getParentNode  获取父结点
*/
function getParentNode(spacialObj, weblordClassString) {
	var bNode = spacialObj;
	while (bNode != null && bNode.saturnClass != weblordClassString) {
		bNode = bNode.parentNode;
	}
	return bNode;
}
/**
* @description	equalsBetweenNodes  判断两结点是否为同一结点
*/
function equalsBetweenNodes(spacialObj, bNode1) {//equalsBetweenNodes
	var bNode = bNode1;
	while (bNode != null) {
		if (bNode == spacialObj) {
			return true;
		}
		bNode = bNode.parentNode;
	}
	return false;
}
/**
* @description	getAbsolutePosition  获取绝对位置
*/
function getAbsolutePosition(spacialObj, offsetElement) {
	var offsetElementOrBody = (offsetElement != null) ? offsetElement : document.body;
	var x = spacialObj.offsetLeft;
	var y = spacialObj.offsetTop;
	var bNode;
	if (browserType == browserType1) {
		bNode = spacialObj.offsetParent;
		while ((bNode != offsetElementOrBody) && bNode != null) {
			x += bNode.offsetLeft - bNode.scrollLeft;
			y += bNode.offsetTop - bNode.scrollTop;
			if (bNode.tagName != "TABLE") {
				x += bNode.clientLeft;
				y += bNode.clientTop;
			}
			bNode = bNode.offsetParent;
		}
	} else {
		bNode = spacialObj.offsetParent;
		while ((bNode != offsetElementOrBody) && bNode != null) {
			x += bNode.offsetLeft;
			y += bNode.offsetTop;
			if (bNode.tagName != "TABLE") {
				x += (bNode.offsetWidth - bNode.clientWidth) / 2;
				y += (bNode.offsetHeight - bNode.clientHeight) / 2;
			}
			bNode = bNode.offsetParent;
		}
		bNode = spacialObj.parentNode;
		while ((bNode != offsetElementOrBody) && bNode != null) {
			if (bNode.scrollLeft) {
				x -= bNode.scrollLeft;
			}
			if (bNode.scrollTop) {
				y -= bNode.scrollTop;
			}
			bNode = bNode.parentNode;
		}
		bNode = offsetElementOrBody.offsetParent;
		while ((bNode != offsetElementOrBody) && bNode != null) {
			x -= bNode.offsetLeft;
			y -= bNode.offsetTop;
			if (bNode.tagName != "TABLE") {
				x += (bNode.offsetWidth - bNode.clientWidth) / 2;
				y += (bNode.offsetHeight - bNode.clientHeight) / 2;
			}
			bNode = bNode.offsetParent;
		}
		bNode = offsetElementOrBody.parentNode;
		while ((bNode != offsetElementOrBody) && bNode != null) {
			if (bNode.scrollLeft) {
				x += bNode.scrollLeft;
			}
			if (bNode.scrollTop) {
				y += bNode.scrollTop;
			}
			bNode = bNode.parentNode;
		}
	}
	return ([x, y]);
}
/**
* @description	setComponentVisible  设置为可见
*/
var elementCollention = new Collection();
function setComponentVisible(spacialObj, visible) {
	if (visible) {
		spacialObj.style.visibility = "visible";
		spacialObj.visible = true;
		var elementCollentionFirst = elementCollention.firstNode;
		while (elementCollentionFirst != null) {
			var control = elementCollentionFirst.Data;
			if (control.offsetWidth > 0) {
				var firstElement = elementCollentionFirst;
				elementCollentionFirst = elementCollentionFirst.priviousElement;
				elementCollention.removeElement(firstElement);
				if (typeof (control.refresh) == "function") {
					control.refresh();
				}
			} else {
				elementCollentionFirst = elementCollentionFirst.priviousElement;
			}
		}
	} else {
		spacialObj.style.visibility = "hidden";
		spacialObj.visible = false;
		if (editorNode1 != null && editorNode1 != spacialObj && equalsBetweenNodes(spacialObj, editorNode1)) {
			decideNode(null);
		}
	}
}
/**
* @description	setComponentDisplay  设置为可见
*/
function setComponentDisplay(spacialObj, visible) {
	if (visible) {
		spacialObj.style.display = "";
		spacialObj.visible = true;
		var elementCollentionFirst = elementCollention.firstNode;
		while (elementCollentionFirst != null) {
			var control = elementCollentionFirst.Data;
			if (control.offsetWidth > 0) {
				var firstElement = elementCollentionFirst;
				elementCollentionFirst = elementCollentionFirst.priviousElement;
				elementCollention.removeElement(firstElement);
				if (typeof (control.refresh) == "function") {
					control.refresh();
				}
			} else {
				elementCollentionFirst = elementCollentionFirst.priviousElement;
			}
		}
	} else {
		spacialObj.style.display = "none";
		spacialObj.visible = false;
		if (editorNode1 != null && editorNode1 != spacialObj && equalsBetweenNodes(spacialObj, editorNode1)) {
			decideNode(null);
		}
	}
}
/**
* @description	setDESCComponentProperties  倒序设置组件属性
*/
function setDESCComponentProperties(control) {
	var spacialObj = bMap03.uArray3.indexOf(control);
	if (spacialObj >= 0) {
		var hashArray = bMap03.uArray3;
		for (var i = spacialObj - 1; i >= 0; i--) {
			var bComponent = hashArray[i];
			if (bComponent.$Vv && !bComponent.disabled && (typeof (bComponent.isReadOnly) != "function" || !bComponent.isReadOnly()) && typeof (bComponent.$A5) == "function" && bComponent.offsetWidth > 0) {
				return bComponent;
			}
		}
	}
	return null;
}
/**
* @description	setDESCComponentProperties  正序设置组件属性
*/
function setASCComponentProperties(control) {
	var spacialObj = bMap03.uArray3.indexOf(control);
	if (spacialObj >= 0) {
		var hashArray = bMap03.uArray3;
		for (var i = spacialObj + 1; i < hashArray.length; i++) {
			var bComponent = hashArray[i];
			if (bComponent.$Vv && !bComponent.disabled && (typeof (bComponent.isReadOnly) != "function" || !bComponent.isReadOnly()) && typeof (bComponent.$A5) == "function" && bComponent.offsetWidth > 0) {
				return bComponent;
			}
		}
	}
	return null;
}
function $c0(control) {
	setTimeout("try {" + "var $_0=document.getElementById(\"" + control.id + "\");" + "$_0.$A5();" + "}catch(e){}", 0);
}
function getPreferenceSetting(key) {
	try {
		eval("var value = " + key + ";");
		return value;
	}
	catch (e) {
		return null;
	}
}
var w = 1;
function getzIndex() {
	return w++;
}
/**
* @description	setControlClassName	 
*/
function setControlClassName(control, className) {
	if (control.className != className) {
		control.className = className;
	}
}
var DIVElementSplitPanel = null;
function getPreferenceSetting(key) {
	try {
		eval("var value = " + key + ";");
		return value;
	}
	catch (e) {
		return null;
	}
}
/**
* @description	getDIVForSplitPanel	获取盛放SplitPanel的容器DIV
*/
function getDIVForSplitPanel() {
	if (DIVElementSplitPanel == null) {
		var DIVElement = document.createElement("DIV");
		DIVElement.style.position = "absolute";
		DIVElement.style.left = 0;
		DIVElement.style.top = 0;
		DIVElement.style.display = "none";
		document.body.appendChild(DIVElement);
		DIVElementSplitPanel = DIVElement;
	}
	DIVElementSplitPanel.style.width = document.body.scrollWidth;
	DIVElementSplitPanel.style.height = document.body.scrollHeight;
	DIVElementSplitPanel.style.zIndex = getzIndex();
	return DIVElementSplitPanel;
}

